import requestI from '@/utils/request'

// 用户列表页面获取用户(分页获取)
export function getUserList(pageInfo) {
	const { page, size } = pageInfo
	return requestI.get(`/user/selectAll?current=${page}&size=${size}`)
}
// 用户列表页面新增用户
export function insertUser(data) {
	return requestI({
		url:'/user/insert',
		method:'post',
		data: data
	})
}
// 用户查询
export function searchUser(pageInfo){
	const {page,size,search} = pageInfo
	return requestI.post(`/user/search?current=${page}&size=${size}&name=${search}`)
}
// 用户列表页面修改用户信息
export function updateUserInfo(data){
	return requestI({
		url:'/user/update',
		method:'post',
		data:data
	})
}
// 用户列表页面删除用户信息
export function deleteUserInfo(userId){
	return requestI.delete(`/user/delete?id=${userId}`)
}
// 用户列表重置密码
export function resetPassWord(userId){
	return requestI.post(`/user/reset?id=${userId}`)
}




// ################################################################################################################################################################




// 角色列表分页获取
export function getRoleList(pageInfo){
	const {page,size} = pageInfo
	return requestI.get(`/SysRole/pageSel?pageNo=${page}&pageSize=${size}`)
} 

// 角色列表新增
export function insertRole(data){
	return requestI({
		method:'post',
		url:'/SysRole/singleInsert',
		data:data
	})
}
// 角色修改
export function updateRole(data){
	return requestI({
		method:'put',
		url:'/SysRole/singleUpdate',
		data:data
	})
}
// 角色删除
export function deleteRole(id){
	return requestI.delete(`/SysRole/DeleteSysRole?roleId=${id}`)
}

// 角色授权
export function roleAuth(id,data){
	return requestI({
		method:'post',
		url:`/SysRole/SysRoleGrant?roleId=${id}`,
		data:data
	})
}







// ################################################################################################################################################################






// 获取资源列表
export function getResoList(pageInfo){
	const {page,size} = pageInfo
	return requestI.get(`/resource/selectAll?current=${page}&size=${size}`)
}
// 新增资源
export function insertReso(data){
	return requestI({
		method:'post',
		url:'/resource/InsertSysResource',
		data:data
	})
}
// 删除资源
export function deleteReso(id){
	return requestI.delete(`/resource/delete?id=${id}`)
}
// 修改资源
export function updateReso(data){
	return requestI({
		method:'put',
		url:'/resource/UpdateSysResource',
		data:data
	})
}